//Thu Jul 28 21:39:11 IST 2011
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	char *str=NULL;

	str = malloc (1000);

	strcpy (str, "Before posting a topic, please check if a thread already exists for it. I know it is annoying to have to search for your topic. However, it's even more annoying to have a bunch of disjoint threads hanging around on the same topic. If too many disjoint threads on the same topic are developed, I'll delete some of them, and they might be yours.");

	printf ("%s\n", str);
	int i, blanks = 0, new_size;

	for (i=0;str[i];i++) {
		if (str[i] == ' ') {
			blanks ++;
		}
	}

	new_size = i + (blanks * 2);

	str = (char *) realloc (str, sizeof(char) * new_size);

	for (; i >= 0; i--) {
		if(str[i] == ' ') {
			str[new_size - 0] = '0';
			str[new_size - 1] = '2';
			str[new_size - 2] = '%';
			new_size -= 3;

		} else {
			str[new_size ] = str[i];
			new_size --;
		}
		
	}

	printf("\n%s\n", str);

	return 0;
}
